#!/usr/bin/env python
# encoding: utf-8
"""
@author: youfeng
@email: youfeng243@163.com
@license: Apache Licence
@file: primary_info.py
@time: 2018/1/10 17:48
"""
from model.crawl_model import GsxtModel, AnnualModel

# 来源：http://www.gsxt.gov.cn/js/annualreportDetail.js?v=201705244049
# 年报企业类型转换表
ANNUAL_TYPE_TO_LAB = {
    'e': {
        AnnualModel.BASE_INFO: True,
        AnnualModel.WEBSITES_INFO: True,
        AnnualModel.SHAREHOLDER_INFO: True,
        AnnualModel.INVESTED_COMPANIES_INFO: True,
        AnnualModel.BRANCH_INFO: True,
        AnnualModel.ENTERPRISE_ASSET_STATUS_INFO: True,
        AnnualModel.EDIT_CHANGE_INFO: True,
        AnnualModel.EDIT_SHAREHOLDING_CHANGE_INFO: True,
        AnnualModel.OUT_GUARANTEE_INFO: True,
    },
    'Sfc': {
        AnnualModel.BASE_INFO: True,
        AnnualModel.WEBSITES_INFO: True,
        AnnualModel.ADMINISTRATIVE_LICENSING_INFO: True,
        AnnualModel.BRANCH_INFO: True,
        AnnualModel.ENTERPRISE_ASSET_STATUS_INFO: True,
        AnnualModel.EDIT_CHANGE_INFO: True,
    },
    'Pb': {
        AnnualModel.BASE_INFO: True,
        AnnualModel.WEBSITES_INFO: True,
        AnnualModel.ADMINISTRATIVE_LICENSING_INFO: True,
        AnnualModel.INVESTED_COMPANIES_INFO: True,
        AnnualModel.ENTERPRISE_ASSET_STATUS_INFO: True,
        AnnualModel.EDIT_CHANGE_INFO: True,
    }
}

# 来源: http://gs.gsxt.gov.cn/js/primaryInfoMain.js?v=201705244049
# 企业类型转换表
ENT_TYPE_TO_LAB = {
    '1': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CONTRIBUTIVE_INFO: True,
        GsxtModel.KEY_PERSON_INFO: True,
        GsxtModel.BRANCH_INFO: True,
        GsxtModel.LIQUIDATION_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        # 动产抵押登记信息
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        # 股权出质登记信息
        GsxtModel.EQUITY_PLEDGED_INFO: True,
        # 检查抽查
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.JUDICIAL_ASSISTANCE_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
        GsxtModel.SIMPLE_CANCER_INFO: True,
    },
    '101': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CONTRIBUTIVE_INFO: True,
        GsxtModel.KEY_PERSON_INFO: True,
        GsxtModel.BRANCH_INFO: True,
        GsxtModel.LIQUIDATION_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.EQUITY_PLEDGED_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.JUDICIAL_ASSISTANCE_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '2': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '3': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CONTRIBUTIVE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
        GsxtModel.SIMPLE_CANCER_INFO: True,
    },
    '4': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '5': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CONTRIBUTIVE_INFO: True,
        GsxtModel.BRANCH_INFO: True,
        GsxtModel.LIQUIDATION_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
        GsxtModel.SIMPLE_CANCER_INFO: True,
    },
    '6': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '7': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CONTRIBUTIVE_INFO: True,
        GsxtModel.BRANCH_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
        GsxtModel.SIMPLE_CANCER_INFO: True,
    },
    '8': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '9': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
        GsxtModel.SIMPLE_CANCER_INFO: True,
    },
    '10': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CONTRIBUTIVE_INFO: True,
        GsxtModel.KEY_PERSON_INFO: True,
        GsxtModel.BRANCH_INFO: True,
        GsxtModel.LIQUIDATION_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.EQUITY_PLEDGED_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.JUDICIAL_ASSISTANCE_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
        GsxtModel.SIMPLE_CANCER_INFO: True,
    },
    '1001': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CONTRIBUTIVE_INFO: True,
        GsxtModel.KEY_PERSON_INFO: True,
        GsxtModel.BRANCH_INFO: True,
        GsxtModel.LIQUIDATION_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.EQUITY_PLEDGED_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.JUDICIAL_ASSISTANCE_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '11': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '12': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CONTRIBUTIVE_INFO: True,
        GsxtModel.BRANCH_INFO: True,
        GsxtModel.LIQUIDATION_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
        GsxtModel.SIMPLE_CANCER_INFO: True,
    },
    '13': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '14': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '15': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CONTRIBUTIVE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.ILLEGAL_PROMISE_ENTERPRISE_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '16': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.KEY_PERSON_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
        GsxtModel.SIMPLE_CANCER_INFO: True,
    },
    '17': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.KEY_PERSON_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ANNUAL_INFO: True,
        'instant': True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
    '18': {
        GsxtModel.BASE_INFO: True,
        GsxtModel.CHANGE_INFO: True,
        GsxtModel.CHATTEL_MORTGAGE_INFO: True,
        GsxtModel.SPOT_CHECK_RESULT_INFO: True,
        GsxtModel.ADMINISTRATIVE_LICENSING_INFO: True,
        GsxtModel.ADMINISTRATIVE_PENALTY_INFO: True,
        GsxtModel.ABNORMAL_OPERATION_INFO: True,
        GsxtModel.TRADEMARK_REGISTRATION_INFO: True,
        GsxtModel.INTELLECTUAL_PROPERTY_INFO: True,
    },
}
